package com.ocp.macro.controller;

import com.ocp.macro.service.DealerListService;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 经销商管理平台控制层
 */
@CrossOrigin
@RestController
@Secured({"ROLE_dealAccount","ROLE_subAccount"}) // 需要经销商总行号权限
public class DealerController {
    @Resource
    public DealerListService dealerListService;
    /**
     * 实现：孙历
     * 解析：前端请求经销商收货信息和经销商信息
     * @return
     */
    @GetMapping("/macro/dealer/dealerinfo")
    public String dealerInfo(){
        return dealerListService.dealerInfo(null);
    }

    /**
     * 实现：孙历
     * 验证原密码
     * @param oldpassword
     * @return
     */
    @PostMapping("/macro/dealer/checkoldpassword")
    public String checkOldPassword(String oldpassword){
        return dealerListService.checkOldPassword(oldpassword,null);
    }

    /**
     ** 实现：孙历
     *解释:经销商修改密码
     * @param newpassword
     * @return
     */
    @PostMapping("/macro/dealer/modifypwd")
   public String modifyPassword(String newpassword){
        return dealerListService.modifyPassword(newpassword, null);
   }


    /**
     * * 实现：孙历
     *查看经销商账号关联的客户信息
     * @return
     */
    @GetMapping("/macro/dealer/customerinfo")
   public String customerInfo(){
        return dealerListService.customerInfo(null);
   }

}
